package com.czzn.czkongzhi;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class PackageControllActivity extends FunctionActivity{
    private boolean isOffPackage1=true,isOffPackage2=true,isOffAllPackage=true;
    Button package1,package2,package_all;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_package_controll);
        package1=  findViewById(R.id.con_package1);
        package2=  findViewById(R.id.con_package2);
        package_all=  findViewById(R.id.all_package);
        package1.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View view) {
                if (isOffPackage1==true){
                    package1.setBackgroundResource(R.drawable.toggle_on);
                    isOffPackage1=false;
                }else {
                    package1.setBackgroundResource(R.drawable.toggle_off);
                    isOffPackage1=true;
                }
                return false;
            }
        });
        package2.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View view) {
                if (isOffPackage2==true){
                    package2.setBackgroundResource(R.drawable.toggle_on);
                    isOffPackage2=false;
                }else {
                    package2.setBackgroundResource(R.drawable.toggle_off);
                    isOffPackage2=true;
                }
                return false;
            }
        });
        package_all.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View view) {
                if (isOffAllPackage==true){
                    package_all.setBackgroundResource(R.drawable.toggle_on);
                    package1.setBackgroundResource(R.drawable.toggle_on);
                    package2.setBackgroundResource(R.drawable.toggle_on);
                    isOffPackage1=false;
                    isOffPackage2=false;
                    isOffAllPackage=false;
                }else {
                    package_all.setBackgroundResource(R.drawable.toggle_off);
                    package1.setBackgroundResource(R.drawable.toggle_off);
                    package2.setBackgroundResource(R.drawable.toggle_off);
                    isOffPackage1=true;
                    isOffPackage2=true;
                    isOffAllPackage=true;
                }
                return false;
            }
        });
    }


}
